<?php
namespace App\Models\Mysql;

use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* @comment 供应商商品关联表
*
* @property int $id
* @property int $g_id 主商品id
* @property int $r_id 子商品id
* @property int $sort 排序
* @property int $percentage 排序
*
*/
class XnSupplierGoodsRelation extends BaseModel
{
    /**
     * @var string
     */
    protected $table = 'xn_supplier_goods_relation';

    /**
     * @var string[]
    */
    protected $fillable = ['id', 'g_id', 'r_gid', 'sort', 'percentage'];

    /**
     * @return HasOne
     */
    public function good(): HasOne
    {
        return $this->hasOne(XnSupplierGoods::class, 'id', 'r_gid');
    }
}
